﻿<Window
    x:Class="ApplicationMainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Ocean_WPF="clr-namespace:Ocean.OceanFramework.WPF;assembly=OceanFrameworkWPF"
    xmlns:Ocean_MVVM="clr-namespace:Ocean.OceanFramework.MVVM;assembly=OceanFrameworkWPF"
    xmlns:be="clr-namespace:BusinessEntityObjects;assembly=BusinessEntityObjects"
    xmlns:local="clr-namespace:WPFLOBMVVM"
    Icon="..\Resources\Images\rss.png"
    Title="http://karlshifflett.wordpress.com"
    Height="600"
    Width="550">
    <Window.Resources>
        
        <Style x:Key="ApplicationMainWindowTabControlStyle" TargetType="{x:Type TabControl}">
            <Setter Property="Margin" Value="7" />
            <Setter Property="IsSynchronizedWithCurrentItem" Value="True" />
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <ContentPresenter Content="{Binding Path=ViewModelFriendlyName}" VerticalAlignment="Center" />
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <DataTemplate DataType="{x:Type local:EditContactsAjaxComboBoxSelectionViewModel}">
            <local:EditContactsAjaxComboBoxSelectionView />
        </DataTemplate>

        <DataTemplate DataType="{x:Type local:EditContactItemsControlSelectionViewModel}">
            <local:EditContactItemsControlSelectionView />
        </DataTemplate>

        <DataTemplate DataType="{x:Type local:RecentActivityViewModel}">
            <local:RecentActivityView />
        </DataTemplate>

    </Window.Resources>

    <DockPanel LastChildFill="True">
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="_File">
                <MenuItem Header="E_xit" Command="{Binding Path=RequestCloseCommand}" />
            </MenuItem>
            <MenuItem Header="_Demo Apps">
                <MenuItem Header="Edit Contacts (_AjaxComboBox used for record selection)" Command="{Binding Path=LoadEditContactsAjaxComboBoxSelectionCommand}" />
                <MenuItem Header="Edit Contacts (_ItemsControl used for record selection)" Command="{Binding Path=LoadEditContactsItemsControlSelectionCommand}" />
            </MenuItem>
            <MenuItem Header="Blog Activity" >
                <MenuItem Command="{Binding Path=RecentBlogActivityCommand}">
                    <MenuItem.Header>
                        <Grid>
                            <ProgressBar Visibility="{Binding Path=LoadingActivityVisibility}" Background="Transparent" BorderThickness="0" Opacity="25" Maximum="100" Minimum="0" Value="{Binding Path=Progress, Mode=OneWay}" />
                            <TextBlock Text="View Last 14 Days Activity" />
                        </Grid>
                    </MenuItem.Header>
                </MenuItem>
                <MenuItem Header="Refresh Activity Data" Command="{Binding Path=RefreshActivityDataCommand}" />
            </MenuItem>
        </Menu>
        <StatusBar DockPanel.Dock="Bottom">
            <StatusBar.Resources>
                <Ocean_WPF:TimeDisplay x:Key="timeDisplay" />
            </StatusBar.Resources>
            <StatusBarItem Margin="5,0,5,0" Content="{Binding Source={StaticResource timeDisplay}, Path=Now, StringFormat=\{0:f\}}" DockPanel.Dock="Right" />
            <StatusBarItem Content="{Binding ViewModelFriendlyName}" />
        </StatusBar>

        <Grid>
            <TabControl ItemsSource="{Binding Path=Forms}" Style="{StaticResource ApplicationMainWindowTabControlStyle}" />            
            <Image Source="../Resources/Images/wpfdisciples.png" Stretch="None" 
                   VerticalAlignment="Center" 
                   HorizontalAlignment="Center"
                   Cursor="Hand"
                   x:Name="imgWPFDisciples"
                   Visibility="{Binding Path=LogoVisibility}" />
        </Grid>

    </DockPanel>    
    
</Window>
